layui.use(['layer', 'form','element'], function(){
 /********************初始化******************/
  var layer = layui.layer
  ,form = layui.form
  ,element = layui.element;
  /********************初始化end******************/
 login()
 $(document).on('keypress',function(e){
    var curKey = e.which;
    if(curKey == 13){
        login()
    }
 })
 function login(){
    form.on("submit(login)",function(data){
        var sendFormData=data.field
        console.log(sendFormData)
        return false;
        var upLoginData={
            url:'user/login',
            sendData:sendFormData,
            type:'get'
        }
        var index =layer.msg('登录中，请稍候',{icon: 16,time:false,shade:0.8});
        setTimeout(function(){
            getAjaxCh(upLoginData,
                function(data){
                    layer.close(index);
                    if(data.result==1){
                        layer.msg('登录成功')
                        var permissionInfo=JSON.stringify(data.data.auth)
                        var userInfo=JSON.stringify(data.data.user)
                        sessionStorage.setItem('permissionInfo',permissionInfo)
                        sessionStorage.setItem('userInfo',userInfo)
                        sessionStorage.setItem('sid',data.sessionid)
                        window.location.href='../../index.html';
                    }else{
                        layer.msg(data.msg)
                    }
                },
                function(data){
                    layer.close(index);
                    console.log(data)
                }
            )
        },1000);
        return false; //阻止表单跳转
    })
 }


















})
